#!/bin/bash
#  $Id: freemed-backup 2227 2005-09-25 12:47:22Z jeff $
#  $Author: jeff $

OURPATH="/usr/share/freemed"
CFGVALUE=${OURPATH}/scripts/cfg-value
CURRENTDATE=$(date +%Y%m%d)

# Extract all neccessary variables from lib/freemed.php
DB_NAME=$(${CFGVALUE} DB_NAME)
DB_USER=$(${CFGVALUE} DB_USER)
DB_PASS=$(${CFGVALUE} DB_PASS)

# MySQL backup with bzip2 compression
mysqldump \
	--single-transaction \
	--user=${DB_USER} \
	--password=${DB_PASS} \
	${DB_NAME} \
	| bzip2 -qc > ${OURPATH}/data/backup/freemed.backup.${CURRENTDATE}.bz2


